package com.smz.controller;

import com.smz.entity.TDepartment;
import com.smz.service.TDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TDepartmentController {

    @Autowired
    private TDepartmentService departmentService;

    @GetMapping("/departments")
    public ResponseEntity<List<TDepartment>> findAllDepartments(){
        return ResponseEntity.ok(departmentService.findAllDepartment());
    }
}
